
package fileby.ctrl.actions.impl;

import fileby.model.ISourceHandler;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

/**
 *
 * @author Jacob
 */
class CloseActiveTabAction extends AbstractAction {

     private ISourceHandler sourceHandler;
     public CloseActiveTabAction(ISourceHandler sourceHandler) {
        super("Close Tab", null);
        this.sourceHandler = sourceHandler;
        putValue(SHORT_DESCRIPTION, "Closte active tab");
        putValue(MNEMONIC_KEY, KeyEvent.VK_T);
        putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.CTRL_DOWN_MASK));
    }

    public void actionPerformed(ActionEvent e) {
        sourceHandler.removeCurrentSource();
    }

}
